var commonjs = require("@rollup/plugin-commonjs");

var defaultConfig = {
  format: "iife",
  strict: false,
};

var baiDuJiSu = [
  // "taskAd",
  // "taskBless",
  // "taskExample",
  // "taskFanKa",
  // "taskGoldAd",
  // "taskMain",
  // "taskRead",
  // "taskSearch5",
  // "taskTreasure",
  // "taskVideo",
  "test",
];
var baiDuDaZi = [
  // "taskFanKa",
  // "taskMain",
  // "taskRead",
  // "taskTreasure",
  // "taskVideo",
  "test",
];
var douYinJiSu = [
  // "taskAd",
  // "taskMain",
  // "taskRead",
  // "taskShop",
  // "taskTreasure",
  "test",
];
var fanQieXiaoShuo = [
  // "taskMain",
  // "taskWatchVideo",
  "test",
];
var shanDianSouSuo = [
  // "taskMain",
  // "taskRead",
  // "taskSearch2",
  // "taskSearch30",
  // "taskTreasure",
  "test",
];
var touTiao = [
  // "taskMain",
  // "taskRead",
  // "taskTreasure",
  "test",
];
var newTouTiao = [
  "test",
];
var touTiaoSouSuoJiSu = [
  // "taskMain",
  // "taskRead",
  // "taskSearch2",
  // "taskSearch30",
  // "taskShop10",
  // "taskTreasure",
  "test",
];
var xiGua = [
  // "taskAd",
  // "taskKeLingQu",
  // "taskMain",
  // "taskRead",
  // "taskTreasure",
  "test",
];
var youShi = [
  // "taskMain",
  // "taskRead",
  // "taskTreasure",
  "test",
];
var YY = [
  // "taskMain",
  // "taskRead",
  // "taskTreasure",
  "test",
];
var test = ["novelReadTest"];

var commonConfig = {
  watch: {
    include: "app/**",
  },
  plugins: [commonjs()],
};

module.exports = [
  ...baiDuJiSu.map((file) => {
    return {
      input: `./app/baiDuJisu/${file}.js`,
      output: {
        file: `output/baiDuJisu/bundle-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    };
  }),
  ...baiDuDaZi.map((file) => {
    return {
      input: `./app/baiDuDaZi/${file}.js`,
      output: {
        file: `output/baiDuDaZi/bundle-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    };
  }),
  ...douYinJiSu.map((file) => {
    return {
      input: `./app/douYinJiSu/${file}.js`,
      output: {
        file: `output/douYinJiSu/bundle-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    };
  }),
  ...fanQieXiaoShuo.map((file) => {
    return {
      input: `./app/fanQieXiaoShuo/${file}.js`,
      output: {
        file: `output/fanQieXiaoShuo/bundle-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    };
  }),
  ...shanDianSouSuo.map((file) => {
    return {
      input: `./app/shanDianSouSuo/${file}.js`,
      output: {
        file: `output/shanDianSouSuo/bundle-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    };
  }),
  ...touTiao.map((file) => {
    return {
      input: `./app/touTiao/${file}.js`,
      output: {
        file: `output/touTiao/bundle-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    };
  }),
  ...newTouTiao.map((file) => {
    return {
      input: `./app/newTouTiao/${file}.js`,
      output: {
        file: `output/newTouTiao/bundle-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    };
  }),
  ...touTiaoSouSuoJiSu.map((file) => {
    return {
      input: `./app/touTiaoSouSuoJiSu/${file}.js`,
      output: {
        file: `output/touTiaoSouSuoJiSu/bundle-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    };
  }),
  ...xiGua.map((file) => {
    return {
      input: `./app/xiGua/${file}.js`,
      output: {
        file: `output/xiGua/bundle-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    };
  }),
  ...youShi.map((file) => {
    return {
      input: `./app/youShi/${file}.js`,
      output: {
        file: `output/youShi/bundle-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    };
  }),
  ...YY.map((file) => {
    return {
      input: `./app/yy/${file}.js`,
      output: {
        file: `output/yy/bundle-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    };
  }),
  ...test.map((file) => {
    return {
      input: `./app/test/${file}.js`,
      output: {
        file: `output/test/bundle-${file}.js`,
        name: `${file}`,
        ...defaultConfig,
      },
      ...commonConfig,
    };
  }),
];
